const app = getApp()

Page({
    data: {
        Name: '',
        Tel: '',
        keyReason: ''
    },
    applyAfterSale: function (e) {
        let that = this;
        let data = {
            username: that.data.Name,
            content: that.data.keyReason,
            tel: that.data.Tel
        }
        getApp().rq('/Index/addLiuyan', data, true, 'POST').then(res => {
            console.log(res);
            if (res.code == 200) {
                that.setData({
                    Name: '',
                    Tel: '',
                    keyReason: ''
                })
                swan.showToast({
                    title: '提交成功',
                    duration: 2000
                })
                setTimeout(function () {
                    swan.hideLoading()
                    swan.switchTab({
                        url: '../index/index'
                    });
                }, 2000)
            } else {
                swan.showToast({
                    title: res.msg
                })
            }
        })
    },
    Name(e) {
        this.setData({
            Name: e.detail.value
        })
    },
    Tel(e) {
        this.setData({
            Tel: e.detail.value
        })
    },
    keyReason(e) {
        this.setData({
            keyReason: e.detail.value
        })
    },

});